package com.richper.springcloudh2020.controller;

import com.richper.springcloudh2020.entities.CommonResult;
import com.richper.springcloudh2020.entities.Payment;
import com.richper.springcloudh2020.service.OrderFeignService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

@RestController
@RequestMapping("/consumer")
public class OrderFeignController {
    @Resource
    private OrderFeignService orderFeignService;

    @PostMapping(value = "/insertPayMent")
    public CommonResult<Integer> insertPayMent(@RequestBody Payment payment) {
        return orderFeignService.insertPayMent(payment);
    }

    @GetMapping(value = "/queryPayMentByID/{id}")
    public CommonResult<Payment> queryPayMentByID(@PathVariable Long id) {
        return orderFeignService.queryPayMentByID(id);
    }

    @GetMapping(value = "/discovery")
    public Object discovery() {
        return orderFeignService.discovery();
    }

    @RequestMapping("/lb/getPort")
    public String getPort() {
        return orderFeignService.getPort();
    }

    @RequestMapping("/feignTimeOutDemo")
    public String feignTimeOutDemo() {
        return orderFeignService.feignTimeOutDemo();
    }
}
